﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using snat.model;
using snat.Exceptions;

namespace gui.Utils {

    /// <summary>
    /// GUI Notifiable NodeItem Class
    /// Node Item holds a ClusterNode, a node ID and a node name property
    /// </summary>
    public class NodeItem {
        public NodeItem(ClusterNode n) {
            try {
                Node = n;
                NodeId = n.ID;
                NodeName = n.Name;
            } catch (NullReferenceException) {
                throw new NodeCastException("The node you are trying to use does not extend ClusterNode and cannot be used with the GUI");
            }
        }

        public ClusterNode Node { set; get; }
        public double NodeId { set;  get; }
        public string NodeName { set; get; }

        public override string ToString() {
            return "" + NodeId + " " + NodeName;
        }

    }
}
